<@t.header>
<link rel="stylesheet" href="${request.contextPath}/app/contract/css/contract-view.css">
</@t.header> <@t.body> <#if !data??>
<div class="container" style="padding-top: 60px;">
	<div class="row">
		<div class="col-md-12">
			<div class="alert alert-danger" role="alert">
				<strong>数据错误！</strong>
				无效的合同信息或者系统异常！
			</div>
		</div>
	</div>
</div>
<#else> <#setting url_escaping_charset='utf-8'>
<div class="navbar navbar-default navbar-fixed-top padding-0 margin-0">
	<div class="container-fluid">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#op-btns" aria-expanded="false">
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
			</button>
			<span class="navbar-brand">
				<i class="icon-globe icon-large"></i>
				${(data.type.collection)?string('收款合同','付款合同')}
			</span>
		</div>

		<div class="navbar-collapse" id="op-btns">
			<ul class="nav navbar-nav">
				<#if roles.canSend>
				<li class="change-status" data-id="${data.id}" data-flowtype="flow_contract" data-status="FS2001_CONTRACT_CREATED">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-signout icon-large"></i>
						</div>
						完成并送交履行
					</a>
				</li>
				</#if>

				<#if roles.canEditForm>
				<li class="edit-form" data-id="${data.id}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-upload icon-large"></i>
						</div>
						编辑表单
					</a>
				</li>
				</#if>

				<#if roles.canUploadContractFile>
				<li class="upload-contract-file" data-id="${data.id}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-upload icon-large"></i>
						</div>
						上传合同文件
					</a>
				</li>
				</#if>

				<#if roles.canStartContract>
				<li class="start-contract" data-id="${data.id}" data-start="${(data.contractStart?string('yyyy-MM-dd'))!.now?string('yyyy-MM-dd')}" data-end="${(data.contractEnd?string('yyyy-MM-dd'))!.now?string('yyyy-MM-dd')}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-ok icon-large"></i>
						</div>
						开始履行
					</a>
				</li>
				<li class="back-contract" data-id="${data.id}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-reply icon-large"></i>
						</div>
						退回
					</a>
				</li>
				</#if>
				
				<#if roles.canRestartContract>
				<li class="redo-contract" data-id="${data.id}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-ok icon-large"></i>
						</div>
						复工
					</a>
				</li>
				</#if>
				
				<#if roles.canPlanMoneyIn>
				<li class="payin-plan" data-id="${data.id}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-money icon-large"></i>
						</div>
						制定收款计划
					</a>
				</li>
				</#if>
				
				<#if roles.canPlanWork>
				<li class="work-plan" data-id="${data.id}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-building icon-large"></i>
						</div>
						制定工期计划
					</a>
				</li>
				</#if>
				
				<#if roles.canCreateTask>
				<li class="do-subcontract" data-id="${data.id}" data-type="TASK_CONTRACT">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-copy icon-large"></i>
						</div>
						生产经营任务书
					</a>
				</li>
				</#if>
				
				<#if roles.canCreateMaterial>
				<li class="do-subcontract" data-id="${data.id}" data-type="MATERIAL_CONTRACT">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-truck icon-large"></i>
						</div>
						材料采购合同
					</a>
				</li>
				</#if>
				
				<#if roles.canCreateService>
				<li class="do-subcontract" data-id="${data.id}" data-type="SUB_SERVICE_CONTRACT">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-wrench icon-large"></i>
						</div>
						劳务分包合同
					</a>
				</li>
				</#if>
				
				<#if roles.canCreateProfessional>
				<li class="do-subcontract" data-id="${data.id}" data-type="SUB_PROFESSIONAL_CONTRACT">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-certificate icon-large"></i>
						</div>
						专业分包合同
					</a>
				</li>
				</#if>
				
				<#if roles.canCreateAgreement>
				<li class="do-subcontract" data-id="${data.id}" data-type="AGREEMENT_CONTRACT">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-paste icon-large"></i>
						</div>
						补充协议
					</a>
				</li>
				</#if>
				
				<#if roles.canFinishContract>
				<li class="finish-project" data-id="${data.id}" data-end-time="${(data.end?string('yyyy-MM-dd'))!''}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-bullhorn icon-large"></i>
						</div>
						竣工
					</a>
				</li>
				</#if>
				
				<#if roles.canPayout>
				<li class="pay-out" data-id="${data.id}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-money icon-large"></i>
						</div>
						费用支出
					</a>
				</li>
				</#if>
				
				<#if roles.canClearContract>
				<li class="clearing-contract" data-id="${data.id}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-credit-card icon-large"></i>
						</div>
						完工结算
					</a>
				</li>
				</#if>
				
				<#if roles.canResetProjectTime>
				<li class="reset-project-time" data-id="${data.id}" data-start="${(data.start?string('yyyy-MM-dd'))!''}" data-end="${(data.end?string('yyyy-MM-dd'))!''}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-random icon-large"></i>
						</div>
						调整实际工期
					</a>
				</li>
				</#if>
				
				<#if roles.canSuspendContract>
				<li class="suspend-contract" data-id="${data.id}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-minus-sign icon-large"></i>
						</div>
						中止待建
					</a>
				</li>
				</#if>
				
				<#if roles.canShutdownContract>
				<li class="shutdown-contract" data-id="${data.id}">
					<a href="javascript:void(0);">
						<div class="text-center op-btn-icon">
							<i class="icon-remove icon-large"></i>
						</div>
						终止
					</a>
				</li>
				</#if>
			</ul>
		</div>
	</div>
</div>
</div>

<div class="container" style="padding-top: 60px;">
	<div role="tabpanel" class="suredy-tabs">
		<ul class="nav nav-tabs" role="tablist" data-active-tab="${tab}">
			<li id="tab-head1" role="presentation" class="active">
				<a href="#tab1" aria-controls="tab1" role="tab" data-toggle="tab">基本信息</a>
			</li>
			<#if roles.shengjiPeople||roles.gongsiLeader>
			<li id="tab-head2" role="presentation" class="">
				<a href="#tab2" aria-controls="tab2" role="tab" data-toggle="tab">已收款项</a>
			</li>
			<li id="tab-head5" role="presentation" class="">
				<a href="#tab5" aria-controls="tab5" role="tab" data-toggle="tab">收款计划</a>
			</li>
			<li id="tab-head8" role="presentation" class="">
				<a href="#tab8" aria-controls="tab8" role="tab" data-toggle="tab">费用支出</a>
			</li>
			<li id="tab-head6" role="presentation" class="">
				<a href="#tab6" aria-controls="tab6" role="tab" data-toggle="tab">工期计划</a>
			</li>
			<li id="tab-head3" role="presentation" class="child-contract">
				<a href="#tab3" aria-controls="tab3" role="tab" data-toggle="tab">子合同信息</a>
			</li>
			</#if>
			<#if roles.shengjiPeople||roles.gongsiLeader||roles.contractZhuanze>
			<li id="tab-head7" role="presentation" class="agreement-view">
				<a href="#tab7" aria-controls="tab7" role="tab" data-toggle="tab">补充协议</a>
			</li>
			</#if>
			<#if roles.shengjiPeople||roles.gongsiLeader>
			<li id="tab-head4" role="presentation" class="">
				<a href="#tab4" aria-controls="tab4" role="tab" data-toggle="tab">操作日志</a>
			</li>
			</#if>
		</ul>

		<div class="tab-content">
			<div role="tabpanel" class="tab-pane fade in active" id="tab1">
				<#include "app/contract/contract-view-info.ftl">
				<hr>
			</div>
			<#if roles.shengjiPeople||roles.gongsiLeader>
			<div role="tabpanel" class="tab-pane fade" id="tab2">
				<#include "app/contract/contract-view-collection.ftl">
				<hr>
			</div>
			<div role="tabpanel" class="tab-pane fade" id="tab3">
				<#include "app/contract/contract-view-subcontract.ftl">
				<hr>
			</div>
			<div role="tabpanel" class="tab-pane fade op-logs" id="tab4">
				<#include "app/contract/contract-view-op-logt.ftl">
				<hr>
			</div>
			<div role="tabpanel" class="tab-pane fade" id="tab5">
				<#include "app/contract/contract-view-payin-plan.ftl">
				<hr>
			</div>
			<div role="tabpanel" class="tab-pane fade" id="tab6">
				<#include "app/contract/contract-view-work-plan.ftl">
				<hr>
			</div>
			</#if>
			<#if roles.shengjiPeople||roles.gongsiLeader||roles.contractZhuanze>
			<div role="tabpanel" class="tab-pane fade" id="tab7">
				<#include "app/contract/contract-view-agreement-contract.ftl">
				<hr>
			</div>
			</#if>
			<#if roles.shengjiPeople||roles.gongsiLeader>
			<div role="tabpanel" class="tab-pane fade" id="tab8">
				<#include "app/contract/contract-view-cost-money.ftl">
				<hr>
			</div>
			</#if>
		</div>
	</div>
</div>
</#if> </@t.body> <@t.foot>
<script src="${request.contextPath}/core/js/jquery.form.js"></script>
<script src="${request.contextPath}/js/suredy-modal.js"></script>
<script src="${request.contextPath}/js/suredy-datetimepicker.js"></script>
<script src="${request.contextPath}/app/js/file.js"></script>
<script src="${request.contextPath}/app/flow/js/flow.js"></script>
<script src="${request.contextPath}/app/js/form-checker.js"></script>
<script src="${request.contextPath}/app/contract/js/contract-view.js"></script>
<script src="${request.contextPath}/app/contract/js/contract-money.js"></script>

<script type="text/javascript">
	var refresh = function() {
		$.suredy.refreshContent('${data.id}', [ 'div.suredy-tabs' ]);
	}
</script>
</@t.foot>
